// map::find
#include <iostream>
#include <string>
#include <map>

int main()
{
	std::map<std::string,int> mymap;
	std::map<std::string,int>::iterator it;

	mymap["test1"]=50;
	mymap["test2"]=100;
	mymap["test3"]=150;
	mymap["test4"]=200;

	it=mymap.find("test2");
	mymap.erase(it);
	mymap.erase(mymap.find("test4"));

	// direct display content:
	std::cout << "Direct display elements in mymap:" << '\n';
	std::cout << "test1 => " << mymap.find("test1")->second << '\n';
	std::cout << "test3 => " << mymap.find("test3")->second << '\n';

	// Iterate through content:
	std::cout << "Iterate through elements in mymap:" << '\n';
	for (it=mymap.begin(); it!=mymap.end(); ++it)
		std::cout << it->first << " => " << it->second << '\n';

	return 0;
}